use ActiveRecord's limit instead of slice

oroce 9 years ago
parent
commit
8ac78eb0d9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/models/agents/delay_agent.rb

+ 1 - 1
app/models/agents/delay_agent.rb

@@ -60,7 +60,7 @@ module Agents
60 60
         events = received_events.where(id: memory['event_ids']).reorder('events.id asc')
61 61
 
62 62
         if options['max_emitted_events'].present?
63
-          events = events.slice(0, options['max_emitted_events'].to_i)
63
+          events = events.limit(options['max_emitted_events'].to_i)
64 64
         end
65 65
 
66 66
         events.each do |event|